package com.xmall.define.base;

/**
 * 返回数据编码
 */
public enum ResultCode {

    SUCCESS(200, "成功"),
    ERROR(500, "失败"),
    NOT_LOGIN(9999, "未登录"),
    NOT_EXIST(501, "数据不存在"),
    PERMISSION_DENIED(502, "权限不足"),
    REPEAT_SUBMIT(502, "表单重复提交"),
    REMOTE_REQUEST_ERROR(503, "远程请求失败"),

    AUTH_LOGIN_ERROR(10000, "账号或密码错误"),
    AUTH_ACCOUNT_EXISTS(10001, "账号已存在"),

    SYS_ROLE_NAME_EXIST(20000, "角色名称已存在"),
    SYS_ROLE_HAS_RELATION_TO_USER(20001, "角色已被用户关联，请解除关联后再删除"),
    SYS_DICT_CODE_EXIST(20002, "字典编码已存在"),

    PRODUCT_GROUP_NAME_REPEAT(30000, "分组名称已存在"),
    PRODUCT_ATTR_NAME_REPEAT(30001, "属性名称已存在"),
    PRODUCT_SAVE_INFO_ERROR(30002, "商品保存信息不全"),
    PRODUCT_STOCK_NOT_ENOUGH(30003, "商品库存不足"),

    PAY_ALIPAY_MOBILE_WAP_ERROR(40000, "支付宝手机网站支付失败"),
    PAY_ALIPAY_REFUND_ERROR(40001, "支付宝退款失败"),

    ORDER_ALREADY_CANCEL(50000, "订单已经取消"),
    ORDER_ALREADY_PAY(50001, "订单已经支付"),
    ORDER_STATUS_ERROR(50002, "订单有误，请重新下单"),
    ORDER_DELETE_ERROR(50003, "订单未确认收货，不允许删除"),
    ORDER_REFUND_ERROR(50004, "订单已发货，请返回重试"),
    ORDER_CONSIGN_ERROR(50005, "发货失败，订单有退款，请先处理"),
    ORDER_CART_LIST_EMPTY_ERROR(50006, "购物车列表不能为空"),
    ORDER_REFUND_REPEAT_ERROR(50007, "退款已经申请，请勿重复操作"),
    ORDER_REFUND_ALREADY_ERROR(50008, "已经退款成功"),
    ORDER_UPDATE_STATUS_ERROR(50009, "订单状态更新失败"),
    ORDER_REFUND_STATUS_ERROR(50010, "退款状态更新失败"),

    SETTING_CONFIG_NAME_EXIST(60000, "配置名称已存在"),

    THIRD_PARTY_UPLOAD_ERROR(70000, "文件上传失败"),

    SEARCH_UPDATE_ERROR(80000, "es服务器保存失败"),
    SEARCH_DELETE_ERROR(80001, "es服务器删除失败"),
    SEARCH_CREATE_INDEX_ERROR(80002, "es服务器创建索引失败"),
    SEARCH_UPDATE_MAPPING_ERROR(80003, "es服务器更新索引映射失败");

    private Integer code;
    private String msg;

    ResultCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
